package com.bwie.bwedu.model.impl;

import android.util.Log;

import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.bwie.bwedu.bean.response.MainInfoResponse;
import com.bwie.bwedu.model.TrackModel;
import com.bwie.bwedu.volley.RequestAPI;

/**
 * Created by Administrator on 2016/7/22.
 */
public class TrackModelImpl implements TrackModel {
    @Override
    public void tack(String flag, String pn, final TackListener listener) {
        RequestAPI.getMainInfo(flag,pn,new Response.Listener<MainInfoResponse>(){
            @Override
            public void onResponse(MainInfoResponse mainInfoResponse) {
                if(mainInfoResponse.ok==true) {
                    listener.onTackSuccess(mainInfoResponse.list);
                }else{
                    listener.onTackFail(mainInfoResponse.msg);
                }
            }
        },new Response.ErrorListener(){
            @Override
            public void onErrorResponse(VolleyError volleyError) {
                listener.onTackFail(volleyError.toString());
            }
        });
    }
}
